Skip to content

spec: add terminfo & capability layer specification - #130

Open
natemoo-re wants to merge 5 commits into
mainfrom
spec/terminfo-layer
Open

natemoo-re wants to merge 5 commits into
mainfrom
spec/terminfo-layer

Conversation

@natemoo-re

@natemoo-re natemoo-re commented Sep 19, 2026 •

Copy link
Copy Markdown
Member

Part 1/4 of the terminfo foundation stack (supersedes the mixed-history #106, which will be closed once this stack lands). Tracks the spec only — implementation PRs are stacked as drafts and must not merge before this spec is approved, per the spec-driven workflow.

What this adds

  • specs/terminfo-spec.md (new, normative): the capability layer — Capabilities, Detection, the CapabilityEvent union, the probe model (query batch + DA1 completion fence, sans-IO), compiled terminfo binary parsing (legacy + extended), the baseline capability set, and the progressive-enhancement evidence model.
  • specs/renderer-spec.md: §7.7 update transaction generalized to resize or capability updates; §7.8 defines capability consumption as deliberately deferred — no renderer output changes in this stack; §8.6 specifies the term.update() public API.
  • specs/input-spec.md: §6 probe-response recognition (how query responses are recognized byte-by-byte and surfaced as events).
  • specs/transitions-spec.md: removes a stale cross-reference note.

Review guidance

The spec is the reviewable artifact here; the stacked implementation PRs (#131, #132, #133) conform to it mechanically. Renderer byte output is unchanged across the entire stack — the first gated consumer (color encoding, #60) is a follow-up and deliberately out of scope (§7.8).

Follow-up protocol work is tracked in #129.

@bombshell-cooper

Copy link
Copy Markdown

No changeset needed

This pull request is classified as no_release_impact: no published package

@natemoo-re
natemoo-re added this pull request to stack #134 September 19, 2026 04:29
@pkg-pr-new

pkg-pr-new Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@bomb.sh/tty@130

commit: 9e0282f

Comment thread specs/terminfo-spec.md Outdated
Comment thread specs/terminfo-spec.md Outdated
Comment thread specs/terminfo-spec.md Outdated
The capability reference table linked every slug to the site root.
Point each at its category-prefixed page (/extensions/…, /modes/…).
State the C signature and that the parser is internal to
detectTerminal(). Returns 0 on success, nonzero on failure; the
nonzero values are deliberately unspecified so tests cannot couple to
them. Failures never reach public callers, who only observe the
resulting Capabilities.
The reducer was exported only so tests could assert (next, bytes)
without a live Term, but a Term is cheap to create and performs no IO,
and every update test already goes through term.update(). Fold the
per-step semantics into Term.update, move the Update type there, and
renumber the host loop section.
Widen Update from { width, height } | CapabilityEvent to
{ width, height } | InputEvent. Events other than resize and capability
are no-op steps, so hosts can pass the full scan() events array without
filtering. Only ResizeEvent carries width/height, so the shapes stay
unambiguous. Matches the implementation in #133.

@cowboyd cowboyd left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants